<%@ page language="java" contentType="text/html; utf-8"
    pageEncoding="utf-8"
    import="java.sql.Date,beans.UserBean,beans.EventBean,java.util.ArrayList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>drop.in - Event Search</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      #sexyline { 
          margin: 25px 0;
          height: 1px;
          background: #eeeee;
          background: -webkit-gradient(linear, 0 0, 100% 0, from(white), to(white), color-stop(50%, grey));
      }​
      #glowing {
      border: 0px solid #D11919;
    border-radius: 6px; 
    padding: 4px 4px 4px 4px;    
     
    -moz-animation-name: glow;
    -moz-animation-timing-function: ease-in;
    -moz-animation-iteration-count: infinite;
    -moz-animation-direction: alternate;
    -moz-animation-duration: 500ms;
	}
	@-moz-keyframes glow {
    0% { box-shadow: 0 0 5px #D11919; }
    100% { box-shadow: 0 0 20px #D11919; }
	}
      <% UserBean currentUser = (UserBean)session.getAttribute("currentSessionUser"); 
	if (currentUser.getAdmin())
		out.print(".navbar-inner { background: #a90329; background: -moz-linear-gradient(top,  #a90329 0%, #8f0222 44%, #6d0019 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a90329), color-stop(44%,#8f0222), color-stop(100%,#6d0019)); background: -webkit-linear-gradient(top,  #a90329 0%,#8f0222 44%,#6d0019 100%); background: linear-gradient(to bottom,  #a90329 0%,#8f0222 44%,#6d0019 100%);}");
		out.print(" .navbar .brand { color: white; }"); %> 
    </style>
    <link href="css/bootstrap-responsive.css" rel="stylesheet">

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    
    <!--Custom JS scripts-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  </head>

  <body>

   <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="http://localhost:8080/dropin/LoginServlet">drop.in</a>
          <div class="nav-collapse">
            <ul class="nav pull-left">
              <li class="active pull-left"><a href="http://localhost:8080/dropin/LoginServlet">Home</a></li>
              <li class="pull-left"><a href="http://localhost:8080/dropin/eventcreation.jsp">Create a new event</a></li>
              <li class="dropdown" id="searchmenu"><a class="dropdown-toggle" data-toggle="dropdown" href="#searchmenu">Search<b class="caret"></b></a>
              <ul class="dropdown-menu">
              <li><a href="http://localhost:8080/dropin/searchuser.jsp">Search Users</a></li>
              <li><a href="http://localhost:8080/dropin/searchevent.jsp">Search Events</a></li>
              </ul>
              </li>
              </ul><ul class="nav pull-right">
              <li class="dropdown pull-right" id="notifications">
              <% ArrayList<EventBean> events = (ArrayList<EventBean>)session.getAttribute("usersevent");
    			int j = 0;
    			for (int i = 0; i < events.size(); i++) {
    				if (events.get(i).isNotification())
    				j++;
    			} %>
    			<a class="dropdown-toggle" data-toggle="dropdown" href="#notifications"> <span <% if (j>0) out.print("id='glowing'"); %>> Notifications (<% out.print(j); %>)</span><b class="caret"></b> </a>
   			<ul class="dropdown-menu">
      		<li style="padding-left: 5px;">Please rate your host/guest(s) for these events:</li>
         			<li class="divider"></li>
      
      			<% for (int i = 0; i < events.size(); i++) {
      			   		if (events.get(i).isNotification()) {
      			   			String startt = events.get(i).getStartTimeStamp().toString();
      			   		startt = startt.substring(0, 19);
            			startt = startt.replace("-", "");
            			startt = startt.replace(":", "");
            			startt = startt.replace(" ", "");
      			   			out.print("<li><a href='http://localhost:8080/dropin/EventServlet?host=" + events.get(i).getHost() + "&start=" + startt + "'>" + events.get(i).getName() + "</a></li>");
      			   		}
      			} %>
    </ul>
  </li>
  <li class="pull-right"><a href="http://localhost:8080/dropin/LogoutServlet">Log Out</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">

      <!-- Main hero unit for a primary marketing message or call to action -->
      <div class="hero-unit" style="padding: 10px 10px 10px 10px;">
        <div style="text-align: center;">
        <h2>Search Events</h2>
        </div>
      </div>
      <div class="row">
        <div class="span12">
        <ul class="nav nav-tabs">
          <li><a href="http://localhost:8080/dropin/searchuser.jsp">Search Users</a></li>
          <li class="active"><a href="http://localhost:8080/dropin/searchevents.jsp">Search Events</a></li>
          <li><a href="http://localhost:8080/dropin/searchresults.jsp"">Search Results</a></li>
        </ul>
		<form id="eventsearch" action="SearchUserServlet?search=event">
		<fieldset>
		  <legend> Insert search options: </legend><br />
		 	<label class="control-label" for="name">Event Name:</label>
		 	<div class="controls">
		 	  <input type="text" class="input-xlarge" id="searchedname" name="searchedname" pattern="[A-z ]*" size="32" placeholder="Name">
		 	  <p class="help-block"> </p>
		 	</div>
		 	<label class="control-label" for="name">Country:</label>
		 	<div class="controls">
		 	  <input type="text" class="input-xlarge" id="searchedcountry" name="searchedcountry" pattern="[A-z ]*" size="32" placeholder="Country">
		 	  <p class="help-block"> </p>
		 	</div>
		 	<label class="control-label" for="name">Region:</label>
		 	<div class="controls">
		 	  <input type="text" class="input-xlarge" id="searchedregion" name="searchedregion" pattern="[A-z ]*" size="32" placeholder="Region">
		 	  <p class="help-block"> </p>
		 	</div>
		 	<label class="control-label" for="name">City:</label>
		 	<div class="controls">
		 	  <input type="text" class="input-xlarge" id="searchedcity" name="searchedcity" pattern="[A-z ]*" size="32" placeholder="City">
		 	  <p class="help-block"> </p>
		 	</div>
		 	<label class="control-label" for="eventdate">Search from:</label>
              <div class="controls" id="fromdate">
                <select name="fromday" id="fromday" class="span1">
                  <option disabled="">Day</option>
                  <% Date now = new Date(System.currentTimeMillis()); %>
                  <option value="01" <% if (now.toString().substring(8, 10).equals("01")) out.print("selected"); %>>1</option>
                  <option value="02" <% if (now.toString().substring(8, 10).equals("02")) out.print("selected"); %>>2</option>
                  <option value="03" <% if (now.toString().substring(8, 10).equals("03")) out.print("selected"); %>>3</option>
                  <option value="04" <% if (now.toString().substring(8, 10).equals("04")) out.print("selected"); %>>4</option>
                  <option value="05" <% if (now.toString().substring(8, 10).equals("05")) out.print("selected"); %>>5</option>
                  <option value="06" <% if (now.toString().substring(8, 10).equals("06")) out.print("selected"); %>>6</option>
                  <option value="07" <% if (now.toString().substring(8, 10).equals("07")) out.print("selected"); %>>7</option>
                  <option value="08" <% if (now.toString().substring(8, 10).equals("08")) out.print("selected"); %>>8</option>
                  <option value="09" <% if (now.toString().substring(8, 10).equals("09")) out.print("selected"); %>>9</option>
                  <option value="10" <% if (now.toString().substring(8, 10).equals("10")) out.print("selected"); %>>10</option>
                  <option value="11" <% if (now.toString().substring(8, 10).equals("11")) out.print("selected"); %>>11</option>
                  <option value="12" <% if (now.toString().substring(8, 10).equals("12")) out.print("selected"); %>>12</option>
                  <option value="13" <% if (now.toString().substring(8, 10).equals("13")) out.print("selected"); %>>13</option>
                  <option value="14" <% if (now.toString().substring(8, 10).equals("14")) out.print("selected"); %>>14</option>
                  <option value="15" <% if (now.toString().substring(8, 10).equals("15")) out.print("selected"); %>>15</option>
                  <option value="16" <% if (now.toString().substring(8, 10).equals("16")) out.print("selected"); %>>16</option>
                  <option value="17" <% if (now.toString().substring(8, 10).equals("17")) out.print("selected"); %>>17</option>
                  <option value="18" <% if (now.toString().substring(8, 10).equals("18")) out.print("selected"); %>>18</option>
                  <option value="19" <% if (now.toString().substring(8, 10).equals("19")) out.print("selected"); %>>19</option>
                  <option value="20" <% if (now.toString().substring(8, 10).equals("20")) out.print("selected"); %>>20</option>
                  <option value="21" <% if (now.toString().substring(8, 10).equals("21")) out.print("selected"); %>>21</option>
                  <option value="22" <% if (now.toString().substring(8, 10).equals("22")) out.print("selected"); %>>22</option>
                  <option value="23" <% if (now.toString().substring(8, 10).equals("23")) out.print("selected"); %>>23</option>
                  <option value="24" <% if (now.toString().substring(8, 10).equals("24")) out.print("selected"); %>>24</option>
                  <option value="25" <% if (now.toString().substring(8, 10).equals("25")) out.print("selected"); %>>25</option>
                  <option value="26" <% if (now.toString().substring(8, 10).equals("26")) out.print("selected"); %>>26</option>
                  <option value="27" <% if (now.toString().substring(8, 10).equals("27")) out.print("selected"); %>>27</option>
                  <option value="28" <% if (now.toString().substring(8, 10).equals("28")) out.print("selected"); %>>28</option>
                  <option value="29" <% if (now.toString().substring(8, 10).equals("29")) out.print("selected"); %>>29</option>
                  <option value="30" <% if (now.toString().substring(8, 10).equals("30")) out.print("selected"); %>>30</option>
                  <option value="31" <% if (now.toString().substring(8, 10).equals("31")) out.print("selected"); %>>31</option>
                </select>
                <select name="frommonth" id="frommonth" class="span2">
                  <option disabled="">Month</option>
                  <option value="01" <% if (now.toString().substring(5, 7).equals("01")) out.print("selected"); %>>January</option>
                  <option value="02" <% if (now.toString().substring(5, 7).equals("02")) out.print("selected"); %>>February</option>
                  <option value="03" <% if (now.toString().substring(5, 7).equals("03")) out.print("selected"); %>>March</option>
                  <option value="04" <% if (now.toString().substring(5, 7).equals("04")) out.print("selected"); %>>April</option>
                  <option value="05" <% if (now.toString().substring(5, 7).equals("05")) out.print("selected"); %>>May</option>
                  <option value="06" <% if (now.toString().substring(5, 7).equals("06")) out.print("selected"); %>>June</option>
                  <option value="07" <% if (now.toString().substring(5, 7).equals("07")) out.print("selected"); %>>July</option>
                  <option value="08" <% if (now.toString().substring(5, 7).equals("08")) out.print("selected"); %>>August</option>
                  <option value="09" <% if (now.toString().substring(5, 7).equals("09")) out.print("selected"); %>>September</option>
                  <option value="10" <% if (now.toString().substring(5, 7).equals("10")) out.print("selected"); %>>October</option>
                  <option value="11" <% if (now.toString().substring(5, 7).equals("11")) out.print("selected"); %>>November</option>
                  <option value="12" <% if (now.toString().substring(5, 7).equals("12")) out.print("selected"); %>>December</option>
                </select>
                <select name="fromyear" id="fromyear" class="span1">
                  <option value="year" disabled="">Year</option>
                  <option value="2012" <% if (now.toString().substring(0, 4).equals("2012")) out.print("selected"); %>>2012</option>
                  <option value="2013" <% if (now.toString().substring(0, 4).equals("2013")) out.print("selected"); %>>2013</option>
                  <option value="2014" <% if (now.toString().substring(0, 4).equals("2014")) out.print("selected"); %>>2014</option>
                  <option value="2015" <% if (now.toString().substring(0, 4).equals("2015")) out.print("selected"); %>>2015</option>
                </select>
                <p class="help-block"> </p>
              </div>
              <label class="control-label" for="eventdate">To:</label>
              <div class="controls" id="todate">
                <select name="today" id="today" class="span1">
                  <option disabled="" selected="">Day</option>
                  <option value="01">1</option>
                  <option value="02">2</option>
                  <option value="03">3</option>
                  <option value="04">4</option>
                  <option value="05">5</option>
                  <option value="06">6</option>
                  <option value="07">7</option>
                  <option value="08">8</option>
                  <option value="09">9</option>
                  <option value="10">10</option>
                  <option value="11">11</option>
                  <option value="12">12</option>
                  <option value="13">13</option>
                  <option value="14">14</option>
                  <option value="15">15</option>
                  <option value="16">16</option>
                  <option value="17">17</option>
                  <option value="18">18</option>
                  <option value="19">19</option>
                  <option value="20">20</option>
                  <option value="21">21</option>
                  <option value="22">22</option>
                  <option value="23">23</option>
                  <option value="24">24</option>
                  <option value="25">25</option>
                  <option value="26">26</option>
                  <option value="27">27</option>
                  <option value="28">28</option>
                  <option value="29">29</option>
                  <option value="30">30</option>
                  <option value="31">31</option>
                </select>
                <select name="tomonth" id="tomonth" class="span2">
                  <option disabled="" selected="">Month</option>
                  <option value="01">January</option>
                  <option value="02">February</option>
                  <option value="03">March</option>
                  <option value="04">April</option>
                  <option value="05">May</option>
                  <option value="06">June</option>
                  <option value="07">July</option>
                  <option value="08">August</option>
                  <option value="09">September</option>
                  <option value="10">October</option>
                  <option value="11">November</option>
                  <option value="12">December</option>
                </select>
                <select name="toyear" id="toyear" class="span1">
                  <option value="year" disabled="" selected="">Year</option>
                  <option value="2012">2012</option>
                  <option value="2013">2013</option>
                  <option value="2014">2014</option>
                  <option value="2015">2015</option>
                </select>
                <p class="help-block"> </p>
              </div>
               <div class="controls">
	             	<form>
					<input type="checkbox" class="input-xlarge" id="full" name="full" class="span1" /> Don't show full<br />
					<input type="checkbox" class="input-xlarge" id="empty" name="empty" class="span1" /> Don't show empty<br />
					</form>
			  </div>		
		 	<div class="controls" >
		 	  <input type="hidden" class="input-xlarge" id="search" name="search" value="event">
		 	</div>
		 	<div class="form-actions">
              <button type="submit" class="btn btn-primary">Search!</button>
			</div>
		   </fieldset>
		  </form>
		  </div> 
		</div> 
		</div>
      <footer>
        <p style="text-align: center; margin-top: 50px; color: grey;">&copy; PiP 2012</p>
      </footer>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/bootstrap-alert.js"></script>
    <script src="js/bootstrap-modal.js"></script>
    <script src="js/bootstrap-dropdown.js"></script>
    <script src="js/bootstrap-scrollspy.js"></script>
    <script src="js/bootstrap-tab.js"></script>
    <script src="js/bootstrap-tooltip.js"></script>
    <script src="js/bootstrap-popover.js"></script>
    <script src="js/bootstrap-button.js"></script>
    <script src="js/bootstrap-collapse.js"></script>
    <script src="js/bootstrap-carousel.js"></script>
    <script src="js/bootstrap-typeahead.js"></script>

  </body>
</html>
